
// 网站的优先访问 - 首屏加载速度  -路由懒加载 - 将文件进行分割，让对应的路由地址每次只加载少量的JS和css
// vue加载的模块换编辑工具 webpack 提供 function(){ return import(path) } 构成函数，该函数可以在webpack运行时分解文件
// webpack如果需要指定分包(拆文件)规则 function(){ return import(/*  */ path) } 

import LoginView from '@/views/LoginView/LoginView.vue'
export default [
    {
        path: '/',
        name: 'login',
        component: LoginView
    },
    {
        path: '/home',
        name: 'home',
        component: () => import(/* webpackChunkName: "home" */'@/views/HomeView/HomeView.vue'),
        children: [
            {
                path: "welcome",
                name: "welcome",
                component: () => import(/* webpackChunkName: "home" */'@/views/HomeView/pages/WelcomeView.vue'),
                meta: {
                    names: [
                        { title: "首页", name: "home" },
                        { title: "数据统计" }
                    ]
                }
            },
            {
                path: "users",
                name: "users",
                component: () => import(/* webpackChunkName: "user" */'@/views/HomeView/pages/UsersView.vue'),
                meta: {
                    names: [
                        { title: "首页", name: "home" },
                        { title: "用户管理" },
                        { title: "用户列表" },
                    ]
                }
            },
            {
                path: "rights",
                name: "rights",
                component: () => import(/* webpackChunkName: "rights" */'@/views/HomeView/pages/RightsView.vue'),
                meta: {
                    names: [
                        { title: "首页", name: "home" },
                        { title: "权限管理" },
                        { title: "权限列表" },
                    ]
                }
            },
            {
                path: "roles",
                name: "roles",
                component: () => import(/* webpackChunkName: "rights" */'@/views/HomeView/pages/RolesView.vue'),
                meta: {
                    names: [
                        { title: "首页", name: "home" },
                        { title: "权限管理" },
                        { title: "角色列表" },
                    ]
                }
            },
            {
                path: "categories",
                name: "categories",
                component: () => import(/* webpackChunkName: "categories" */'@/views/HomeView/pages/CategoriesView.vue'),
                meta: {
                    names: [
                        { title: "首页", name: "home" },
                        { title: "商品管理" },
                        { title: "商品分类" },
                    ]
                }
            },
            {
                path: "goods",
                component: () => import(/* webpackChunkName: "goods" */'@/views/HomeView/pages/goods/LayoutView.vue'),
                children: [
                    {
                        path: "",
                        name: "goods",
                        component: () => import(/* webpackChunkName: "goods" */'@/views/HomeView/pages/goods/GoodsView.vue'),
                        meta: {
                            names: [
                                { title: "首页", name: "home" },
                                { title: "商品管理" },
                                { title: "商品列表" },
                            ]
                        }
                    },
                    {
                        path: "add",
                        name: "add",
                        component: () => import(/* webpackChunkName: "goods" */'@/views/HomeView/pages/goods/AddGoods.vue'),
                        meta: {
                            names: [
                                { title: "首页", name: "home" },
                                { title: "商品管理" },
                                { title: "商品列表" },
                                { title: "商品添加" },
                            ]
                        }
                    },
                ]
            },
            // {
            //     path:"goods",
            //     name:"goods",
            //     component:GoodsView,
            //     meta:{
            //         names:[
            //             {title:"首页",name:"home"},
            //             {title:"商品管理"},
            //             {title:"商品列表"},
            //         ]
            //     }
            // },
            // {
            //     path:"goods/add",
            //     name:"add",
            //     component:AddGoods,
            //     meta:{
            //         names:[
            //             {title:"首页",name:"home"},
            //             {title:"商品管理"},
            //             {title:"商品列表"},
            //             {title:"商品添加"},
            //         ]
            //     }
            // },
            {
                path: "*",
                component: () => import(/* webpackChunkName: "notFound" */'@/views/HomeView/pages/NotFound.vue')
            }
        ]
    },
    {
        path: "*",
        redirect: "/"
    }
]